﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KMFrame.Core;
using SzCourt.Logic.BLL;

namespace SzCourt.WebSite.manager
{
    public partial class newsExamine : System.Web.UI.Page
    {
        public int PageIndex = 1;
        public int PageSize = 20;
        public int TotalPage = 1;
        public string Keyword = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!AdminSession.SessionBox.CheckUserSession())
            {
                Response.Redirect("/manager/login.aspx");
            }
            if (!this.IsPostBack)
            {
                getList();
            }
        }

        private void getList()
        {
            this.PageIndex = string.IsNullOrEmpty(Request.QueryString["PageIndex"]) ? 1 : Convert.ToInt32(Request.QueryString["PageIndex"]);
            this.Keyword = string.IsNullOrEmpty(Request.QueryString["keyword"]) ? "" : Request.QueryString["keyword"];

            
            PageParam param = new PageParam();
            param.PageIndex = this.PageIndex;
            param.PageSize = this.PageSize;

            ReporterHome bll = new ReporterHome();
            PageResult result = (PageResult)bll.GetReporterHomeList(param, this.Keyword);

            if (result != null)
            {
                this.rptDataList.DataSource = result.ResultList;
                this.rptDataList.DataBind();

                this.pager1.RecordCount = result.TotalCount;
                this.pager1.TotalPage = result.PageCount;
                this.pager1.PageIndex = this.PageIndex;
                this.pager1.PageSize = this.PageSize;
                this.pager1.LinkUrl = "/manager/newsExamine.aspx?PageIndex=" + this.PageIndex.ToString() + "&keyword=" + this.Keyword;
                this.pager1.IsResult = false;


            }
        }

    }
}